package com.csun.cmny.provider.controller.admin;

import com.csun.cmny.core.support.BaseController;
import com.csun.cmny.provider.model.dto.log.DeviceLogQueryDto;
import com.csun.cmny.provider.resolver.CmnyMessageSource;
import com.csun.cmny.provider.service.DmcDeviceLogService;
import com.csun.cmny.util.wrapper.WrapMapper;
import com.csun.cmny.util.wrapper.Wrapper;
import com.github.pagehelper.PageInfo;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-07-16 17:49
 * @Description: the class device log controller
 */
@RestController
@RequestMapping(value = "/log", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class DmcDeviceLogController extends BaseController {

    @Resource
    private DmcDeviceLogService dmcDeviceLogService;
    @Resource
    private CmnyMessageSource cmnyMessageSource;

    @RequestMapping(value = "/queryListWithPage", method = RequestMethod.POST)
    public Wrapper queryDeviceLogListWithPage(DeviceLogQueryDto deviceLogQueryDto) {

        PageInfo pageInfo = dmcDeviceLogService.queryDeviceLogListWithPage(deviceLogQueryDto);

       // return WrapMapper.ok(pageInfo);
        return WrapMapper.wrap(Wrapper.SUCCESS_CODE,cmnyMessageSource.getMessage("operation.success", null),pageInfo);
    }

}
